package com.zimin.cloud.user.controller.api;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zimin.cloud.mine.pojo.user.business.UserBO;
import com.zimin.cloud.mine.pojo.user.business.UserInfoBO;
import com.zimin.cloud.user.pojo.entity.UserInfo;
import com.zimin.shared.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.POST;

/**
 * <p>
 * 用户表 前端控制器 接口
 * </p>
 *
 * @author zimin
 * @since 2022-06-14 15:53
 */
@RequestMapping
@Api(value = "用户API", tags = {"用户API"})
public interface IUserController {

    /**
     * <p>获取用户信息</p>
     *
     * @return com.zimin.shared.pojo.Result
     * @since 2022-06-22 17:17:23
     */
    @GetMapping("/users")
    Result getUserInfo();

    /**
     * <p>获取公钥</p>
     *
     * @return com.zimin.shared.pojo.Result
     * @since 2022-06-20 10:13:41
     */
    @GetMapping("/rsa-pks")
    @ApiOperation(value = "用户登录获取公钥", notes = "用户登录获取公钥", httpMethod = "GET")
    Result getRsaPublicKey();

    @PostMapping("users")
    @ApiOperation(value = "新用户注册", notes = "新用户注册", httpMethod = "POST")
    Result addUser(@RequestBody @Validated UserBO userBO);

    /**
     * <p>用户登录并获取凭证</p>
     *
     * @param userBO 登陆对象
     * @return com.zimin.shared.pojo.Result
     * @since 2022-06-21 11:35:02
     */
    @PostMapping("/tokens")
    @ApiOperation(value = "用户登录并获取凭证", notes = "用户登录并获取凭证", httpMethod = "POST")
    Result login(@RequestBody @Validated UserBO userBO) throws Exception;

    /**
     * <p>更新用户信息</p>
     *
     * @param userBO 用户对象
     * @return com.zimin.shared.pojo.Result
     * @since 2022-06-25 21:51:40
     */
    @PutMapping("/user-infos")
    @ApiOperation(value = "更新用户信息", notes = "更新用户信息", httpMethod = "PUT")
    Result updateUserInfos(@RequestBody @Validated UserInfoBO userInfoBO) throws Exception;


    /**
     * <p>分页查询关注用户详情</p>
     *
     * @param page 分页对象
     * @param userInfoBO 查询对象
     * @return com.zimin.shared.pojo.Result
     * @since 2022-06-28 21:54:07
     */
    @GetMapping("/user-infos")
    @ApiOperation(value = "分页查询关注用户详情", notes = "分页查询关注用户详情", httpMethod = "GET")
    Result getUserInfos(Page<UserInfo> page, UserInfoBO userInfoBO);

    /**
     * <p>用户登录升级</p>
     *
     * @param userBO
     * @return com.zimin.shared.pojo.Result
     * @since 2022-07-04 22:46:45
     */
    @PostMapping("/user-dts")
    @ApiOperation(value = "用户登录", notes = "用户登录", httpMethod = "POST")
    Result loginForDts(@RequestBody @Validated UserBO userBO) throws Exception;

    /**
     * <p>刷新token</p>
     * @return com.zimin.shared.pojo.Result
     * @since 2022-07-04 22:47:00
     */
    @DeleteMapping("/refresh-tokens")
    @ApiOperation(value = "删除token", notes = "删除token", httpMethod = "DELETE")
    Result logout() throws Exception;

    @PostMapping("/access-tokens")
    @ApiOperation(value = "刷新accessToken", notes = "刷新accessToken", httpMethod = "POST")
    Result refreshAccessToken() throws Exception;



}
